﻿using Domain.Entitys.Pinv;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCore.EntityConfigurations.Pinv
{
    public class PoConfiguration: IEntityTypeConfiguration<Pinv_Po>
    {
        public void Configure(EntityTypeBuilder<Pinv_Po> builder)
        {
            //设置表名和主键
            builder.ToTable("pinv_po");
            builder.HasKey(e => e.Po_Id);
            //配置与明细的关系
            builder.HasMany(e => e.Details)
                .WithOne(e => e.Min)
                .HasForeignKey(e => e.Po_Id);
        }
    }
}
